/*
 * COPYRIGHT. HSBC HOLDINGS PLC 2016. ALL RIGHTS RESERVED.
 * 
 * This software is only to be used for the purpose for which it has been
 * provided. No part of it is to be reproduced, disassembled, transmitted,
 * stored in a retrieval system nor translated in any human or computer
 * language in any way or for any other purposes whatsoever without the
 * written consent of HSBC Holdings plc.
 */
package com.pactera.integral.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.pactera.integral.common.repository.GenericRepository;
import com.pactera.integral.entity.Group;



@Repository("groupDao")
public interface GroupDao extends GenericRepository<Group, String>{

    /**
     * @param string
     * @return
     */
    Group findByName(String roleName);
    

    Group findByGroupId(String groupId);
    
	@Query(value = "select sg.name from sys_group sg inner join sys_user_group sug on sug.group_id = sg.group_id where sug.user_id =:userId", nativeQuery = true)
    public List<String> findNamebyUserId(@Param("userId")String userId);
    
}
